# from selenium import webdriver
#
# from selenium.webdriver.chrome.options import Options
#
# chrome_options = Options()
# chrome_options.add_argument('--headless')
# chrome_options.add_argument('--disable-gpu')
#
# browser = webdriver.Chrome(options=chrome_options)
#
# url = 'https://www.baidu.com'
# browser.get(url)
#
# browser.save_screenshot("baidu.png")

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

def share_brower():
    chrome_options = Options()
    chrome_options.add_argument('--headless')
    chrome_options.add_argument('--disable-gpu')
    browser = webdriver.Chrome(options=chrome_options)
    return browser

browser = share_brower()
url = 'https://www.baidu.com'
browser.get(url)